#include<16f877a.h>
#device ADC=10
#include<stdlib.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
//#use delay(clock=20000000)
#use delay(clock=11592000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
int vib_val=0;
//unsigned char flag;


void main()
{

   int Temp_Val,Light_Val,Sound_bit,i;

   setup_adc_ports(ALL_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   port_b_pullups(TRUE);

   printf("at+cmgf=1\n");

           putc(0x0d);
           putc(0x0d);
           delay_us(100);

while (TRUE)
   {

   //Reading vibration Value
         /*   set_adc_channel( 0 );
            delay_us(20);
            vib_val = Read_ADC();
            printf("%u\n\r",vib_val);*/
    if(!input(PIN_B0) )
            {

            printf("at+cmgs=\"+919965826279\"\n");

            putc(0x0d);
            putc(0x0a);
            delay_ms(100);

            printf("ALERT!!! Collision Occured");
            putc(26);

            delay_ms(1000);

            }
            
            //delay_ms(1000);delay_ms(1000);//delay_ms(1000);delay_ms(1000);

      }


}
